package com.ch.dream.activity.shortstory;

import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;

import com.ch.dream.R;
import com.ch.dream.base.BaseActivity;
import com.ch.dream.logic.shortstory.CollectLogic;
import com.ch.dream.tools.ViewTools;

public class CollectActivity extends BaseActivity {

	private CollectLogic logic;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		try{
			setTitle(getResources().getString(R.string.back),"短故事收藏","清空");
			logic =new CollectLogic(this);
			logic.setViews(R.layout.s_collect);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	@Override
	protected void onResume() {
		logic.init();
		super.onResume();
	}
	
	@Override
	protected void handlerTitleBarEvent(int mode) {
		if(mode==LEFT_BUTTON){
			finish();
		}else if(mode==RIGHT_BUTTON){
			ViewTools.showConfirm(this, "提示信息", "确认要删除所有收藏吗？", "确认","取消", new OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					logic.clearCollect();
				}
				
			},new OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});
		}
	}

}
